<%--
  Created by IntelliJ IDEA.
  User: user
  Date: 2021/7/19
  Time: 18:53
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
    <head>
        <title>首页</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="layui/css/layui.css" media="all">
    </head>
    <body>
        <ul class="layui-nav">
            <li class="layui-nav-item">
                欢迎光临
            </li>
            <li class="layui-nav-item">
                <c:if test="${sessionScope.loginUser ne null}">
                    <a href="/toUpdateUser">${sessionScope.loginUser.u_name}</a>
                </c:if>
                <c:if test="${sessionScope.loginUser eq null}">
                    <a href="/toLogin">请登录<span class="layui-badge-dot"></span></a>
                </c:if>
            </li>
            <li class="layui-nav-item">
                <c:if test="${sessionScope.loginUser ne null}">
                    <a href="/toRegist">免费注册</a>
                </c:if>
                <c:if test="${sessionScope.loginUser eq null}">
                    <a href="/toRegist">免费注册<span class="layui-badge-dot"></span></a>
                </c:if>
            </li>
            <li class="layui-nav-item">
                <a href="/toRegist">购物车<span class="layui-badge">9</span></a>
            </li>
            <li class="layui-nav-item">
                <a ><img src="//t.cn/RCzsdCq" class="layui-nav-img">我</a>
                <c:if test="${sessionScope.loginUser.isAdmin == 1}">
                    <dl class="layui-nav-child">
                        <dd><a href="">用户管理</a></dd>
                        <dd><a href="/toCommodityIndex">商品管理</a></dd>
                        <dd><a href="/removeLogin">退出登录</a></dd>
                    </dl>
                </c:if>
                <c:if test="${sessionScope.loginUser.isAdmin == 0}">
                    <dl class="layui-nav-child">
                        <dd><a href="/toUpdateUser">修改信息</a></dd>
                        <dd><a href="/removeLogin">退出登录</a></dd>
                    </dl>
                </c:if>

            </li>
        </ul>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>


        <ul class="flow-default" style="height: 300px;" id="LAY_demo2"></ul>

        <script src="layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript">

            layui.use(['form', 'table'], function () {
                var $ = layui.jquery,
                    form = layui.form,
                    table = layui.table;
                // //监听导航点击
                // element.on('nav(*)', function(elem){
                //     //console.log(elem)
                //     layer.msg(elem.text());
                // });

                table.render({
                    elem: '#currentTableId',
                    url: '/listAllCommodity',//查询类型数据
                    cols: [[
                        {field: 'DriverPicture', width: 200,title:'照片',templet:'<div><img src="picture/1.png"></div>'},
                        {field: 'c_name', width: 200, title: '商品名称'},
                        {field: 'c_price', width: 200, title: '商品价格'},
                        {field: 'c_type', width: 200, title: '商品类型'},
                        {field: 'c_sales', width: 200, title: '商品销售量'},
                        {field: 'c_stock', width: 200, title: '商品库存'},
                    ]],
                    /*limits: [10, 15, 20, 25, 50, 100],
                    limit: 15,  <!--默认显示15条-->
                    page: true,*/
                    skin: 'line',
                    id:'testReload'

                });
            });


        </script>
    </body>
</html>
